/**
 * 
 */
package com.tvshows.front.factory;

import org.apache.log4j.Logger;
import org.eclipse.swt.widgets.Composite;

/**
 * @author tMidy
 * <p>
 * Class that creates a dialog type
 * </p>
 */
public final class DialogFactory
{

    /**
     * private constructor
     */
    private DialogFactory()
    {

    }

    /**
     * The dialog view to create
     */
    private static com.tvshows.front.ui.dialog.DialogUI dialogUI;

    /**
     * Creates a dialog according to several criterias
     * 
     * @param typeUI the {@link TypeUI}
     * @param parent the parent composite
     * @return a DialogView
     */
    public static com.tvshows.front.ui.dialog.DialogUI createDialogUI( TypeUI typeUI, Composite parent )
    {

        switch ( typeUI )
        {

            case ADD_FAVORITE:
                dialogUI = new com.tvshows.front.view.dialog.DialogAddFavoriteView( parent, 0 );
                break;
            case ERROR_VIEW:
                dialogUI = new com.tvshows.front.view.dialog.DialogErrorView( parent, 0 );
                break;
            case OPTION_VIEW:
                dialogUI = new com.tvshows.front.view.dialog.DialogOptionsView( parent, 0 );
                break;
            default:
                Logger.getLogger( DialogFactory.class ).error( "La vue " + typeUI.name() + " n'a pas été trouvée" );
                break;
        }
        if ( dialogUI != null )
        {
            parent.setSize( dialogUI.getSize() );
        }

        return dialogUI;
    }

}
